# -*- coding:utf-8 -*-
# @Time: 2020/9/24 21:43
# @Author: 周铖鑫
# @Description：动画
# @File: Animation.py
import numpy as np
from matplotlib import  pyplot as plt
import  matplotlib.animation as animation
fig,ax=plt.subplots()
x=np.arange(0,2*np.pi,0.01)
line,=ax.plot(x,np.sin(x))
def animate(i):
    line.set_ydata(np.sin(x+i/100))
    return line,

def init():
    line.set_ydata(np.sin(x ))
    return line,
#frame帧  interval频率 blit是否更新整张图
ani=animation.FuncAnimation(fig=fig,func=animate,frames=100,init_func=init(),interval=20,blit=False)
plt.show()